package com.newbingo.dto;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;


import com.newbingo.dao.imple.IAgentDao;
import com.newbingo.dto.imple.IBetSettingDto;
import com.newbingo.entity.Agent;
import com.newbingo.entity.BetSetting;
import com.newbingo.util.Pager;

public class BetSettingDto implements IBetSettingDto,Serializable {
	
	private Integer cellid;
	private String cellName;
	private float rate;
	private Integer minBet;
	private Integer maxBet;
	private Integer gamePlayId;
	private Integer agentid;
	

	private IAgentDao agentDao=null;
	public IAgentDao getAgentDao() {
		return agentDao;
	}
	public void setAgentDao(IAgentDao agentDao) {
		this.agentDao = agentDao;
	}
	public Pager findBetSettingByPlayIdAndAgentId(Integer agentId,
			Integer gamePlayId) {
		System.out.println("BetSettingDto："+agentId+"——"+gamePlayId);
		List<BetSetting> betSettings=new ArrayList<BetSetting>();
		Pager pager=new Pager();
		Agent agent=agentDao.findById(agentId);
		List<BetSettingDto> betList=new ArrayList<BetSettingDto>();
		Set<BetSetting> settings= agent.getSettings();
		System.out.println(settings.size());
		BetSettingDto dto=null;
		for(BetSetting bs:settings){	
			dto=new BetSettingDto();
			if(gamePlayId.equals(bs.getBettingCell().getGamePlay().getId())){
				dto.setGamePlayId(bs.getBettingCell().getGamePlay().getId());
				dto.setCellid(bs.getBettingCell().getId());
				dto.setCellName(bs.getBettingCell().getName());
				dto.setRate(bs.getBettingCell().getRate());
				dto.setMinBet(bs.getMinBet());
				dto.setMaxBet(bs.getMaxBet());
				dto.setAgentid(bs.getAgent().getUno());
				betList.add(dto);
			}
		}
		pager.setData(betList);
		return pager;
	}
	
//	public BetSettingDto getBetSettingDtoObjectById(Integer agentId,Integer gamePlayId,Integer cellId){
//		System.out.println("BetSettingDto中输出传值："+agentId+"||"+gamePlayId+"||"+cellId);
//		Pager pager=this.findBetSettingByPlayIdAndAgentId(agentId, gamePlayId);
//		List<BetSettingDto> list=pager.getData();
//		System.out.println(list.size());
//		BetSettingDto betSetting=null;
//		for (BetSettingDto bet : list) {
//			System.out.println("bet的数据:"+bet.getCellName());
//			betSetting=new BetSettingDto();
//			if (cellId.equals(bet.getCellid())) {
//				betSetting.setAgentid(bet.getAgentid());
//				betSetting.setCellid(bet.getCellid());
//				betSetting.setCellName(bet.getCellName());
//				betSetting.setRate(bet.getRate());
//				betSetting.setMinBet(bet.getMinBet());
//				betSetting.setMaxBet(bet.getMaxBet());
//			}
//		}
//		return betSetting;
//	}
	
	public Integer getCellid() {
		return cellid;
	}
	public void setCellid(Integer cellid) {
		this.cellid = cellid;
	}
	public String getCellName() {
		return cellName;
	}
	public void setCellName(String cellName) {
		this.cellName = cellName;
	}
	public float getRate() {
		return rate;
	}
	public void setRate(float rate) {
		this.rate = rate;
	}
	public Integer getMinBet() {
		return minBet;
	}
	public void setMinBet(Integer minBet) {
		this.minBet = minBet;
	}
	public Integer getMaxBet() {
		return maxBet;
	}
	public void setMaxBet(Integer maxBet) {
		this.maxBet = maxBet;
	}
	public Integer getGamePlayId() {
		return gamePlayId;
	}
	public void setGamePlayId(Integer gamePlayId) {
		this.gamePlayId = gamePlayId;
	}
	public Integer getAgentid() {
		return agentid;
	}
	public void setAgentid(Integer agentid) {
		this.agentid = agentid;
	}

	
}
